#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2017/12/5 0005 17:08
# @Author  : Arliki
# @File    :
from lib_test.mysql_db import Mysql


# from . import mysql_db

def run():
    config = ['localhost', 3306, 'root', 'root', 'youxian']
    db = Mysql(*config)
    tabel = "ecs_wxrefun"
    col1 = "order_sn"
    col2 = "order_sn,user_id"
    col3 = ""
    condi1 = "id<50"
    condi2 = ""
    orderby = "id desc"
    groupby = "user_id"
    sql = "select * from ecs_collage_index"
    print("-----------------select---------------")
    print(db.MS(tabel, col1, condi1))
    print(db.MS(tabel, col2, condi2))
    print(db.MS(tabel, col3, condi2, orderby=orderby))
    print(db.MS(tabel, col3, condi2, orderby=orderby, groupby=groupby))
    print(db.select(sql))
    print('-----------------insert------------------')
    # data1 = {'order_sn': 121, 'user_id': 321}
    # data2 = "select user_id,order_sn from ecs_collage_pay where user_id=9"
    # columns = ('user_id', 'order_sn')
    # print(db.insert(tabel, data1))
    # print(db.insert(tabel, data2, columns, True))
    # print('-----------------delete------------------')
    # print(db.delete(tabel, condi1))
    # print(db.delete(tabel, data1))


if __name__ == '__main__':
    run()
